package com.lk.recvice.mq.receive.handler.datas;

import com.alibaba.fastjson.JSONObject;
import com.lk.recvice.mq.receive.ReceiveHandler;
import com.lk.recvice.mq.receive.handler.MqManager;
import com.lk.recvice.mq.receive.handler.MqManagerBuilder;
import org.springframework.amqp.core.Message;
import org.springframework.stereotype.Service;

@Service
public class ReportDataReceiveHandler implements ReceiveHandler {

	/**
	 * 处理接收到的数据
	 * TODO
	 * @param message
	 * @param context
	 */
	@Override
	public void receiveHandler(Message message, String context) {
		//将要加工的消息转发到对应的业务类中
		System.out.println("处理数据消息：" + context);
		JSONObject parseObject = JSONObject.parseObject(context);
		String handleType = parseObject.getString("type");

		MqManager mqManager = MqManagerBuilder.getInstance().build(handleType);
		mqManager.doWork(parseObject);

	}


}
